<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
    <script>

    var a = 'abc'
        {
            var a = '123' 
            console.log(a);
        }

        console.log(a);


        var a = 'abc'
        {
            console.log(a); //未声明前使用会报错
            let a = '123' 
            console.log(a);
        }

        console.log(a);
    </script>
</body>
</html>